<?php
class DefaultHotAction extends FrontendAction
{
	public function __construct()
	{
		parent::__construct();
		$this->responseType = 'tpl';
		$this->layout = 'index';
		$this->data['menu']	= 'hot';
	}

	public function execute()
	{
		$page			= $this->getPage();
		
		$ltConfig		= C('LtConfig');
		$pagerConfig	= $ltConfig->get('pagination.pager');
		$pageSize		= 100;
		$pagerConfig['per_page']		= $pageSize;
		if($this->data['isRobot'])

		$pagerConfig['num_links_show']	= 20;

		$ltConfig->addConfig(array('pagination.pager'=>$pagerConfig));
		
		$num 			= $pageSize;
		$start	 		= ($page-1) * $pageSize;
		
		$k				= $this->context->get('k');
		$con			= array();
		if($k!='')
		{
			$con['first_char']	= $k;
		}
		$hotkeyService			= new HotkeyService();
		$list					= $hotkeyService->getList($con,'id DESC',$start,$num);
		$this->data['list']		= $list['rows'];
		$totalNum				= $list['count'];
		
		$baseUrl 	= C('LtUrl')->generate('Default', 'Hot', array('p' => ':page','k'=>$k));
		
		$pagination 	= new PiscesPagination;
		$pagination->init();
		$this->data['pages'] = $pagination->pager($page, $totalNum, $baseUrl);
		
		$this->data['seo']['title']	= $k.'-热门搜索-'.$page;
	}
}
